package utility;

import javax.swing.JComboBox;

import database.Database;

public final class Constants {
	
	public static final long serialVersionUID = 1L;
	public static final int HOURS_DAY = 24;
	public static final int MIN_DAY = 60;
	public static final int TIME_INCREMENT = 1;

	public static final int SS_MILLIS = 1000;
	public static final int MM_HOUR = 60;	
	public static final int MM_MILLIS =  MM_HOUR*SS_MILLIS;
	public static final int HH_MILLIS =  MM_MILLIS*MM_HOUR;
	public static final int DAY_MILLIS = HH_MILLIS*24;
	public static final int DAY_MM = MM_HOUR*24;
	public static final int TEN_MINUTES_MILLIS = 36000000;//MM_MILLIS*10;
	public static final long MONTH_MILLIS = 2592000000L;//DAY_MILLIS*30;
	public static final long YEAR_MILLIS = 31536000000L;//DAY_MILLIS*365;
	public static final int MILLIS_MIN = 60000;
	public static final int  WEEK_MILLIS = DAY_MILLIS*7;
	public static final int HH_SECONDS = 3600;
	public static final int SS_HOUR = 60;
		
	public static String[] activities;
	public static JComboBox activitiesList;
	
	private Constants(){} //not allowed to instantiate 
	
	public static int getSelectedActivityId(){
		updateActivitiesList();
		if (activitiesList == null) activitiesList = new JComboBox(activities);
		return activitiesList.getSelectedIndex()+1;
	}
	
	public static void addActivity2List(final String selectedActivity){
		Database.addActivity(selectedActivity);
		updateActivitiesList();
		activitiesList.addItem(selectedActivity);
		activitiesList.setSelectedItem(selectedActivity);
	}
	
	public static void updateActivitiesList(){
		activities = Database.getActivities();
	}
}
